package org.mwiki.scala.bot.http.actions

/**
 * Created by IntelliJ IDEA.
 * User: ilya
 * Date: Mar 28, 2010
 * Time: 10:35:53 PM
 * To change this template use File | Settings | File Templates.
 */

object Query {
  val query = Map("action" -> "query")

  def meta(meta: String) = query + ("meta" -> meta)

  def list(list: String) = query + ("list" -> list)

  def prop(prop: String, title: String) =
    query + ("prop" -> prop, "titles" -> title)

  /**
   * Returns overall site information. 
   */
  def siteInfo() = meta("siteinfo") + ("siprop" -> "statistics")

  def userInfo() = meta("userinfo")

  def categoryMembers(title: String) =
    list("categorymembers") + ("cmtitle" -> title)

  def imageUsage(title: String) =
    list("imageusage") + ("iutitle" -> title)

  def extUrlUsage(euquery: String) =
    list("exturlusage") + ("euquery" -> euquery)

  def search(search: String) =
    list("search") + ("srsearch" -> search)

  def categoryInfo(title: String) = prop("categoryinfo", title)

  def revisions(title: String) =
    prop("revisions", title) + ("rvprop" -> "timestamp|user|comment|content")

  def langLinks(title: String) = prop("langlinks", title)

  def images(title: String) = prop("images", title)

}